package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseListResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.stationgroup.*;
import com.zmj.sy.mom.srv.aps.service.StationGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "工作组-工位 关联")
@RestController
@RequestMapping("/stationGroup")
public class StationGroupController {

    private final StationGroupService stationGroupService;

    @ApiOperation("1.7.1 查看某个工作组下的工位列表")
    @GetMapping("/list")
    public BaseListResVo<StationGroupListResVo> list(BaseIdReqVo reqVo){
        return stationGroupService.list(reqVo);
    }

    @ApiOperation("1.7.2 给某个工作组下添加工位")
    @PostMapping("/add")
    public BaseResVo add(@RequestBody StationGroupAddReqVo reqVo){
        stationGroupService.add(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("1.7.3 某个工作组下的工位修改")
    @PostMapping("/edit")
    public BaseResVo edit(@RequestBody StationGroupEditReqVo reqVo){
        stationGroupService.edit(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("1.7.4 某个工作组下的工位删除")
    @GetMapping("/delete")
    public BaseResVo delete(BaseIdReqVo reqVo){
        stationGroupService.delete(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("工作组和工位的树")
    @GetMapping("/tree")
    public BaseListResVo<StationGroupTreeResVo> tree(){
        return stationGroupService.tree();
    }

    @ApiOperation("WMS底座焊接调整工位所属工作组")
    @PostMapping("/changeStorageGroup")
    public BaseResVo changeStorageGroup(@RequestBody GroupChangeDto dto){
        stationGroupService.changeStorageGroup(dto);
        return BaseResVo.ok();
    }

}
